//
//  shameTableViewCell.m
//  YiXiu
//
//  Created by yixiu on 16/7/19.
//  Copyright © 2016年 zzz. All rights reserved.
//

#import "shameTableViewCell.h"
#import "UIView+Extension.h"

@interface shameTableViewCell ()


@property(nonatomic,strong)UILabel * mainLab;
//@property(nonatomic,strong)UILabel * detilLab;
@property(nonatomic,strong)UIImageView * icon;
@property(nonatomic,strong)UILabel * contentLab;


@end


@implementation shameTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithTableView:(UITableView *)tableView{
    
    static NSString * identf = @"cell";
    self = [tableView dequeueReusableCellWithIdentifier:identf];
    
    if (!self) {
        self = [[shameTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identf];
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self addCell];
        
//        [self addTopLineWithColor:UIColorFromRGB(0xcccccc) andHeight:1];
        
        
    }
        return self;
}

-(void)addCell{
    
    UIImageView * imageV = [[UIImageView alloc]init];
    imageV.frame = CGRectMake(12, 10, 100, 72);
    [imageV setImage:[UIImage imageNamed:@"testIMG" ]];
    [self addSubview:imageV];
    self.icon = imageV;
    
    UILabel * mainLab = [[UILabel alloc]initWithFrame:CGRectMake(133, 11, KScreenWidth -133 -23, (94-12-15)/2+1)];
    
//    mainLab.text = @"张航宇张航宇张航宇张航宇张航宇张航宇张航宇张航宇张航宇张航宇张航宇";
    mainLab.font = [UIFont boldSystemFontOfSize:14];
    mainLab.numberOfLines = 2;
    [self addSubview:mainLab];
    self.mainLab = mainLab;
    
    UILabel * viceLab = [[UILabel alloc]initWithFrame:CGRectMake(133, (94-12-15)/2 +20, KScreenWidth -133 -23, (94-12-15)/2-10+8)];
//    viceLab.text = @"一羞一羞一羞一羞一羞一羞一羞一羞一羞一羞一羞一羞一羞一羞一羞一羞一羞一羞一羞一羞一羞一羞一羞";
    viceLab.numberOfLines = 2;

//    viceLab.font = [UIFont boldSystemFontOfSize:12];
//    viceLab.font = [UIFont systemFontSize:12];
    viceLab.font = [UIFont systemFontOfSize:12];
    
//    viceLab.font = [UIFont preferredFontForTextStyle:<#(nonnull NSString *)#>]
    viceLab.textColor = UIColorFromRGB(0x999999);
    [self addSubview:viceLab];
    self.contentLab = viceLab;
}


- (void)setModel:(shamModel *)model{
    
    _model = model;
    
    [self.icon sd_setImageWithURL:[NSURL URLWithString:model.pt_url] placeholderImage:[UIImage imageNamed:@"testIMG"]];
    
    self.mainLab.text = model.p_headline;
    self.contentLab.text = model.p_content;
}







@end
